<template>
  <div class="view-coursewrae">
    <video v-if="type == 0" :src="view + fileId" controls="controls" class="video"/>
    <audio v-if="type == 1" :src="view + fileId" controls="controls" class="audio"/>
    <iframe v-if="type == 2" :src="'/pdfJs/web/viewer.html?scorm_file_path=' + pdfsrc" class="pdf" width="100%" height="400px"/>
  </div>
</template>
<script>
export default {
  name: 'ViewCourseWare',
  props: {
    type: {
      type: Number,
      default: 0
    },
    fileId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      view: '/API-RESOURCE/webView?fid='
    }
  },
  computed: {

    pdfsrc() {
      console.log(this.type)
      // const host = window.location.host
      // const http = 'http://'
      return this.view + this.fileId
    }
  }
}
</script>
<style lang="scss" rel="stylesheet/scss">
$mainColor: #18A5FD;
.view-coursewrae{
  .video{
    width: 100%;
    height: 400px;
    background-color: black;
  }
  .audio{
    width: 100%;
  }
}
</style>

